#include "human.h"

const char *danger_as_cstr(Danger danger)
{
    switch(danger)
    {
        case HARMLESS:        return "harmless";
        case COMMON:          return "common";
        case DANGEROUS:       return "dangerous";
        case DANGER_COUNT:    return "ERROR";
        default:              return "ERROR";
    }
}

size_t human_danger_num(Human *humans, Danger d, size_t size)
{
    size_t num = 0;
    Human *tmp = humans;
    for(size_t i = 0; i < size; ++i, ++tmp)
        if (tmp->danger == d)
            num += 1;
    return num;
}

size_t human_danger_num_meeting_prob(Human *humans, Danger d, float p, size_t size)
{
    size_t num = 0;
    Human *tmp = humans;
    for(size_t i = 0; i < size; ++i, ++tmp)
        if (tmp->danger == d && tmp->prob >= p)
            num += 1;
    return num;
}
